/**
 * 
 */
package com.momosw.games.engine.util;

import java.util.List;

import com.momosw.games.engine.Game;
import com.momosw.games.engine.events.Event;
import com.momosw.games.engine.player.Player;

/**
 * <b>Project:</b> JerichoCardGame<br />
 * <b>Package:</b> com.momosw.games.engine.util<br />
 * <b>Class:</b> Utils.java<br />
 * <br />
 * <i>GSI 2011</i><br />
 *
 * @author Miguel Coronado (miguelcb84@gmail.com)
 * @version	Aug 20, 2011
 *
 */
public class Utils {
    
    /**
     *  
     * Inform all the players in the game the current turn starts 
     * @param game
     * @param ownNotice
     * @param othersNotice
     */
    public static void notifyPlayers (Game game, Player current, String ownNotice, String othersNotice) {
        List<Player> players = game.getPlayers();
        for (Player player : players){
            if (player.equals(current)){
                player.notify(ownNotice);
            }
            else{
                player.notify(othersNotice);
            }
        }
    }

    public static void notifyPlayers (Game game, Event event){
        List<Player> players = game.getPlayers();
        for (Player player : players){
            player.notify(event);
        }
    }
    
    public static void notifyPlayers (Game game, Player current, Event event){
        List<Player> players = game.getPlayers();
        for (Player player : players){
            if (player.equals(current)){
                player.notify(event);
            }
            else{
                player.notify(event.hidePrivate());
            }
        }
    }
    
    public static void notifyPlayers(Game game, String notice) {
        List<Player> players = game.getPlayers();
        for (Player player : players){
            player.notify(notice);
        }
    }
}
